package edu.ynu.se.xiecheng.achitectureclass.controller;

import edu.ynu.se.xiecheng.achitectureclass.common.controller.LogicController;
import edu.ynu.se.xiecheng.achitectureclass.dao.UserDao;
import edu.ynu.se.xiecheng.achitectureclass.entity.User;
import edu.ynu.se.xiecheng.achitectureclass.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户的控制器")
@RestController
@RequestMapping("/user")
public class UserController extends LogicController<UserService, UserDao, User, Long> {

    public UserController(@Autowired UserService service) {
        super(service);
    }

    @RequestMapping("/login")
    public User login(String username, String password) {
        return service.login(username, password);
    }

    @RequestMapping("/register")
    public User register(String username, String password) {
        return service.register(username, password);
    }
}
